/**
 * Created with IntelliJ IDEA.
 * Description:
 * User:
 * Date: 2024-11-08
 * Time: 19:13
 */
public class Main {

    public static int max(int A[], int l, int h, int max) {
        if (l == h) {
            return A[l];
        }

        int mid = (l + h) / 2;
        int maxLeft = max(A, l, mid, max);
        int maxRight = max(A, mid + 1, h, max);

        return Math.max(maxLeft, maxRight);
    }

    public static void main(String[] args) {
        int[] A = {14, 21, 7, 45, 28, 3, 56, 32};
        int maxVal = max(A, 0, A.length - 1, 0);
        System.out.println("The maximum value in the array is: " + maxVal);
    }
}